// 在这里引入所有需要的proto生成的js文件
import ProtoBufClass_pb from './proto_js/ProtoBufClass_pb'
import Init_pb from './proto_js/proto/Init_pb'
import ChatList_pb from './proto_js/proto/ChatList_pb'
import ChatHistory_pb from './proto_js/proto/ChatHistory_pb'
import AccountNumber_pb from './proto_js/proto/AccountNumber_pb'
import GroupInfo_pb from './proto_js/proto/GroupInfo_pb'
import AddGroupOrFriendRequest_pb from './proto_js/proto/AddGroupOrFriendRequest_pb'
import WebSocketInit_pb from './proto_js/proto/WebSocketInit_pb'
import GetChatHistory_pb from './proto_js/proto/GetChatHistory_pb'

// 全部通过这个方法去挂在到Vue原型对象上
// 最后在main.js中调用这个方法把Vue实例传入就可以实现拆分了
// 拆分后就不会导致main.js出现很长的导入代码了，清晰的多 
export function ProtoJSFileImport(Vue) {

    Vue.prototype.$protobufClass = ProtoBufClass_pb
    Vue.prototype.$init = Init_pb
    Vue.prototype.$chatList = ChatList_pb
    Vue.prototype.$chatHistory = ChatHistory_pb
    Vue.prototype.$accountNumber = AccountNumber_pb
    Vue.prototype.$groupInfo = GroupInfo_pb
    Vue.prototype.$addGroupOrFriendRequest = AddGroupOrFriendRequest_pb
    Vue.prototype.$webSocketInit = WebSocketInit_pb
    Vue.prototype.$getChatHistory = GetChatHistory_pb

}

// 一些其他地方需要的方法也这样导出，到时候要用（比如前置路由守卫中就需要这个）
export function deserializeBinary(data) {
    return ProtoBufClass_pb.PackageInfo.deserializeBinary(data);
}

